// components/chapters-comp/chapters-comp.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list: Object,
    index: Number,
    currentIndex: Number,
    type: Number || String,
    bookName: String,
    sourceUuid: String,
    bookId: String

  },

  /**
   * 组件的初始数据
   */
  data: {
    isDark:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    setIndex() {

      if (this.properties.type == 1) {

        this.triggerEvent("setCurrentIndex", this.properties.index)

      } else if (this.properties.type == 0) {
        wx.navigateTo({
          url: `/pages/readingdetailed/readingdetailed?sourceUuid=${this.properties.sourceUuid}&list=${JSON.stringify([])}&bookName=${this.properties.bookName}&bookId=${this.properties.bookId}&currentIndex=${this.properties.index}`,
        })
      }
    }
  },
  lifetimes: {
    ready: function () {

      let storageDark = wx.getStorageSync('storageDark') ? wx.getStorageSync('storageDark') : false
      this.setData({
        isDark: storageDark
      })
    }
  }
})
